import matplotlib
import pylab
from scipy import linalg,array,dot,mat,transpose
import sys
import random
from context_functions import *

if len(sys.argv)<2: 
	exit()
dbfile = sys.argv[1]
matrix,intent,extent = readContext(dbfile)

tmatrix = transpose(array(matrix))

density = []
for col in range(len(tmatrix)):
	dens = int(sum(tmatrix[col]))
	density.append(dens)
print density
h,bins=matplotlib.numpy.histogram(density, bins=10)
matplotlib.pyplot.plot(bins[1:],h,'s',ls='--')
matplotlib.pyplot.xlabel("Density")
matplotlib.pyplot.ylabel("hits")
pylab.show()
